// ignore_for_file: must_be_immutable

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:junyeyishu/utils/ScreenFit.dart';

class QGUserNavigationBar extends StatelessWidget {
  String? title;
  TextStyle? titleStyle;
  Widget? rightItem;
  QGUserNavigationBar({super.key, this.title, this.rightItem, this.titleStyle});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 26 + max(kSafeTop, 20),
      padding: EdgeInsets.only(top: max(kSafeTop, 20)),
      child: Stack(
        children: [
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            bottom: 0,
            child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
              rightItem ?? Container(),
            ]),
          ),
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            bottom: 0,
            child: Visibility(
              visible: (title?.length ?? 0) > 0,
              child: Container(
                alignment: Alignment.center,
                child: Text(
                  title ?? "",
                  textAlign: TextAlign.center,
                  style: titleStyle ??
                      TextStyle(
                          color: Color(0xFF111111),
                          fontSize: 15.rpx,
                          fontWeight: FontWeight.bold),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
